﻿﻿using System;
using System.Collections.Generic;
using System.Text;
namespace WebApplication1.DDD.Models.Entity.Common
{
    public class user_group:NFinal.Struct
    {
		public System.Int64 id;
		public System.String title;
		public System.Int64? grade;
		public System.Int64? upgrade_exp;
		public System.Int64? amount;
		public System.Int64? point;
		public System.Double? discount;
		public System.Int16? is_default;
		public System.Int16? is_upgrade;
		public System.Int16? is_lock;
		#region 从get列表初始化实体类
		public static bool TryParse(NFinal.NameValueCollection get,out user_group par)
		{
			par=new user_group();
			try
			{
						System.Int64.TryParse(get["id"],out par.id);
						par.title=get["title"];
						par.grade=null;
						if(get["grade"]!=null)
						{
							par.grade=System.Int64.Parse(get["grade"]);
						}
						par.upgrade_exp=null;
						if(get["upgrade_exp"]!=null)
						{
							par.upgrade_exp=System.Int64.Parse(get["upgrade_exp"]);
						}
						par.amount=null;
						if(get["amount"]!=null)
						{
							par.amount=System.Int64.Parse(get["amount"]);
						}
						par.point=null;
						if(get["point"]!=null)
						{
							par.point=System.Int64.Parse(get["point"]);
						}
						par.discount=null;
						if(get["discount"]!=null)
						{
							par.discount=System.Double.Parse(get["discount"]);
						}
						par.is_default=null;
						if(get["is_default"]!=null)
						{
							par.is_default=System.Int16.Parse(get["is_default"]);
						}
						par.is_upgrade=null;
						if(get["is_upgrade"]!=null)
						{
							par.is_upgrade=System.Int16.Parse(get["is_upgrade"]);
						}
						par.is_lock=null;
						if(get["is_lock"]!=null)
						{
							par.is_lock=System.Int16.Parse(get["is_lock"]);
						}
			}
			catch
			{
				return false;
			}
			return true;
		}
		#endregion
		#region 写Json字符串
		public override void WriteJson(System.IO.TextWriter tw)
		{
			tw.Write("{");
					tw.Write("\"id\":");
					tw.Write(id.ToString());
					tw.Write(",");
					tw.Write("\"title\":");
					tw.Write("\"");
					tw.Write(title==null?"null":title);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"grade\":");
					tw.Write(grade==null?"null" : grade.ToString());
					tw.Write(",");
					tw.Write("\"upgrade_exp\":");
					tw.Write(upgrade_exp==null?"null" : upgrade_exp.ToString());
					tw.Write(",");
					tw.Write("\"amount\":");
					tw.Write(amount==null?"null" : amount.ToString());
					tw.Write(",");
					tw.Write("\"point\":");
					tw.Write(point==null?"null" : point.ToString());
					tw.Write(",");
					tw.Write("\"discount\":");
					tw.Write(discount==null?"null" : discount.ToString());
					tw.Write(",");
					tw.Write("\"is_default\":");
					tw.Write(is_default==null?"null" : is_default.ToString());
					tw.Write(",");
					tw.Write("\"is_upgrade\":");
					tw.Write(is_upgrade==null?"null" : is_upgrade.ToString());
					tw.Write(",");
					tw.Write("\"is_lock\":");
					tw.Write(is_lock==null?"null" : is_lock.ToString());
			tw.Write("}");
		}
		#endregion
    }
}
